using System;
using System.Collections.Generic;
using System.Text;

namespace Common
{
    /// <summary>
    /// 
    /// </summary>
    [Serializable]
    public struct FieldTransformer : IComparable
    {
        /// <summary></summary>
        public SchemaObject SourceEntity;
        /// <summary></summary>
        public string SourceFieldName;
        /// <summary></summary>
        public FieldDataType SourceFieldDataType;
        /// <summary></summary>
        public FieldDataType TargetFieldDataType;
        /// <summary></summary>
        public string CodeSnippet;

        #region IComparable Members

        /// <summary>
        /// 
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public int CompareTo(object obj)
        {
            if (obj.GetType() == typeof(FieldTransformer))
            {
                FieldTransformer fieldTransformer = (FieldTransformer)obj;
                int result = this.SourceEntity.CompareTo(fieldTransformer.SourceEntity);
                if (result == 0)
                {
                    result = this.SourceFieldName.CompareTo(fieldTransformer.SourceFieldName);
                }
                return result;
            }
            else
            {
                return 0;
            }
        }

        #endregion
    }
}
